package com.yehuishou.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yehuishou.dao.PartsDao;
import com.yehuishou.pojo.AssemblyPartsList;
import com.yehuishou.pojo.BackOrder;
import com.yehuishou.pojo.Parts;
import com.yehuishou.pojo.User;
import com.yehuishou.pojo.Version;
import com.yehuishou.service.PartsService;
@Service
public class PartsServiceImpl implements PartsService {

	
	
	@Autowired
	private PartsDao partsDao;
	@Override
	public PageInfo<Parts> get(Integer pageNum, Integer pageSize,Parts parts) {
		PageHelper.startPage(pageNum, pageSize);
		List<Parts> list=partsDao.get(parts);
		PageInfo<Parts> pageinfo=new PageInfo<Parts>(list);
		System.out.println("222222:"+pageinfo.getPages());
		return pageinfo;
		
		
		
	}
	@Override
	public boolean delete(Integer pid) {
		int i=partsDao.delete(pid);
		if(i>0){
			return true;
		}else{
			return false;
		}
		
	}
	@Override
	public void insert(Parts parts) {
		 partsDao.insert(parts);
		
	}
	@Override
	public List<Parts> getProcessor() {
		
		return partsDao.getProcessor();
	}
	@Override
	public List<String> getPhone() {
		
		return partsDao.getPhone();
	}
	@Override
	public List<Parts> getUid(String phone) {
	
		return partsDao.getUid(phone);
	}
	@Override
	public List<Version> getProcessor_version(Integer xid) {
		
		return partsDao.getProcessor_version(xid);
	}
	@Override
	public List<Version> getMemory_version() {
	return partsDao.getMemory_version();
	}
	@Override
	public List<Version> getMainboard_version() {
		return partsDao.getMainboard_version();
	}
	@Override
	public List<Version> getVideo_card_version() {
		return partsDao.getVideo_card_version();
	}
	@Override
	public boolean deleteStore(Integer sid) {
		   Integer sInteger=partsDao.deleteStore(sid);
		   if(sInteger>0){
				return true;
			}else{
				return false;
			}
		
	}
	@Override
	public void updatePrice1(Parts parts) {
          partsDao.updatePrice1(parts);		
	}
	@Override
	public PageInfo<AssemblyPartsList> getList(Integer pageNum, Integer pageSize, AssemblyPartsList assemblyPartsList) {
		
		PageHelper.startPage(pageNum, pageSize);
		List<AssemblyPartsList> list=partsDao.getList(assemblyPartsList);
		PageInfo<AssemblyPartsList> pageinfo=new PageInfo<AssemblyPartsList>(list);
		return pageinfo;
	
	}
	@Override
	public void insertPart(AssemblyPartsList assemblyPartsList) {
		partsDao.insertPart(assemblyPartsList);
		
	}
	@Override
	public boolean deletesPart(AssemblyPartsList assemblyPartsList) {
		  int s= partsDao.deletesPart(assemblyPartsList);
		  if(s>0){
				return true;
			}else{
				return false;
			}
	}
	@Override
	public void deleteP(Integer[] gids) {
		partsDao.deleteP(gids);
		
	}
	

	
	
	

}
